﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using KPIS.GERP.GHRMS.DAL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.IDAL;
using KPIS.GERP.GHRMS.DALFactory;
using KPIS.GERP.GHRMS.MODEL;

namespace KPIS.GERP.GHRMS.BLL
{
    public sealed class MasFamilyHoodBLL : IMasFamilyHoodBLL
    {
        private static readonly IMasFamilyHoodDAL dal = DataAccess.CreateMasterFamilyHoods();        

        public DataSet LoadFamilyHoods(Nullable<int> Sequence)
        {
            MasFamilyHoodInfo info = new MasFamilyHoodInfo();

            if (Sequence.HasValue)
                info.Sequence = (int)Sequence;

            return dal.LoadFamilyHoods(info);
        }
        //public IList<MasFamilyHoodInfo> ListFamilyHoods()
        //{
        //    return dal.ListFamilyHoods(new MasFamilyHoodInfo(0));
        //}
        //public IList<MasFamilyHoodInfo> ListFamilyHoods(int Sequence)
        //{
        //    return dal.ListFamilyHoods(new MasFamilyHoodInfo(Sequence));
        //}

        public void Insert(string Name, int CreatedBy)
        {
            try
            {
                dal.Insert(new MasFamilyHoodInfo(0, Name, "", CreatedBy, 0));
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Update(int Sequence, string Name, int UpdatedBy)
        {
            try
            {
                dal.Update(new MasFamilyHoodInfo(Sequence, Name, "", 0, UpdatedBy));
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Delete(int Sequence, int UpdatedBy)
        {
            try
            {
                dal.Delete(Sequence, UpdatedBy);
            }
            catch
            {
                throw new Exception("");
            }
        }
    }
}
